package mapreduce;

import java.io.File;
import java.io.IOException;

import util.property;

public class JobConf {

	private String InputDir;
	private String OutputDir;
	private Class<?> ReduceOutputKeyClass;
	private Class<?> ReduceInputKeyClass;
	private Class<?> MapOutputKeyClass;
	private Class<?> MapInputValueClass;
	private Class<?> MapInputKeyClass;
	private Class<?> MapOutputValueClass;
	private Class<?> ReduceOutputValueClass;
	private Class<?> ReduceInputValueClass;
	private Class<?> MapperClass;
	private Class<?> ReducerClass;
	private static final String JOBCONF_XML = "c:/mapreduce/conf/jobconf.property";
	private int Numofreduce;
	private String RuningDirectory;
	private long AmountperMap;
	private long buffersize;
	private boolean sortflag;
	private boolean memoryflag;

	public long getBuffersize() {
		return buffersize;
	}

	public void setBuffersize(long buffersize) {
		this.buffersize = buffersize;
	}
    
	public void setMemoryflag(boolean flag)
	{
		this.memoryflag=flag;
	}
	
	public boolean getMemoryflag()
	{
		return this.memoryflag;
	}
	
	public long getAmountperMap() {
		return AmountperMap;
	}

	public JobConf(String conf_file) throws IOException, ClassNotFoundException {
		property pt = new property(new File(conf_file));
		this.RuningDirectory = pt.getString("RuningDirectory", "job/");
		this.Numofreduce = pt.getInt("Numofreduce", 2);
		this.AmountperMap = pt.getInt("AmountperMap", 64000);
		this.buffersize = pt.getInt("buffersize", 64000);
	}

	public JobConf() throws IOException, ClassNotFoundException {
		this(JOBCONF_XML);
	}

	
	public Class<?> getMapInputKeyClass() {
		return MapInputKeyClass;
	}

	
	public void setMapInputKeyClass(Class<?> MapInputKeyClass) {
		this.MapInputKeyClass = MapInputKeyClass;
	}
    

	public Class<?> getMapInputValueClass() {
		return MapInputValueClass;
	}

	
	public void setMapInputValueClass(Class<?> MapInputValueClass) {
		this.MapInputValueClass = MapInputValueClass;
	}

	

	public Class<?> getMapOutputKeyClass() {
		return MapOutputKeyClass;
	}

	
	public void setMapOutputKeyClass(Class<?> MapOutputKeyClass) {
		this.MapOutputKeyClass = MapOutputKeyClass;
	}
    
	public void setsortflag(boolean flag)
	{
		this.sortflag=flag;
	}
	
	public boolean getsortflag()
	{
		return this.sortflag;
	}

	public String getInputDir() {
		return InputDir;
	}

	
	public void setInputDir(String InputDir) {
		this.InputDir = InputDir;
	}

	

	public String getOutputDir() {
		return OutputDir;
	}

	
	public void setOutputDir(String OutputDir) {
		this.OutputDir = OutputDir;
	}

	
	public Class<?> getReduceOutputKeyClass() {
		return ReduceOutputKeyClass;
	}

	public Class<?> getReduceInputKeyClass() {
		return ReduceInputKeyClass;
	}

	public void setReduceOutputKeyClass(Class<?> OutputKeyClass) {
		this.ReduceOutputKeyClass = OutputKeyClass;
	}

	public void setReduceInputKeyClass(Class<?> InputKeyClass) {
		this.ReduceInputKeyClass = InputKeyClass;
	}

	public Class<?> getMapOutputValueClass() {
		return MapOutputValueClass;
	}

	public void setMapOutputValueClass(Class<?> MapOutputValueClass) {
		this.MapOutputValueClass = MapOutputValueClass;
	}

	public Class<?> getReduceOutputValueClass() {
		return ReduceOutputValueClass;
	}

	public Class<?> getReduceInputValueClass() {
		return ReduceInputValueClass;
	}

	public void setReduceInputValueClass(Class<?> InputValueClass) {
		this.ReduceInputValueClass = InputValueClass;
	}

	public void setReduceOutputValueClass(Class<?> OutputValueClass) {
		this.ReduceOutputValueClass = OutputValueClass;
	}

	public int getNumofreduce() {
		return Numofreduce;
	}

	
	public void setNumofreduce(int Numofreduce) {
		this.Numofreduce = Numofreduce;
	}


	public String getRuningDirectory() {
		return RuningDirectory;
	}

	
	public void setRuningDirectory(String RuningDirectory) {
		this.RuningDirectory = RuningDirectory;
	}

	public void setMapperClass(Class<?> MapperClass) {
		this.MapperClass = MapperClass;
	}

	public void setReducerClass(Class<?> ReducerClass) {
		this.ReducerClass = ReducerClass;
	}

	public Class<?> getMapperClass() {
		return this.MapperClass;
	}

	public Class<?> getReduceClass() {
		return this.ReducerClass;
	}
}
